package com.dhy.util;

import org.springframework.stereotype.Component;

@Component
public class AjaxResult {

    private Boolean success = true;

    private String message = "操作成功";

    private Object data;

    private AjaxResult(Build build) {

        this.success = build.success;

        this.message = build.message;

        this.data = build.data;

    }

    private static class Build{

        private Boolean success = true;

        private String message = "操作成功";

        private Object data;

        public Build setSuccess(Boolean success) {

            this.success = success;

            return this;

        }

        public Build setMessage(String message) {

            this.message = message;

            return this;

        }

        public Build setData(Object data) {

            this.data = data;

            return this;

        }

        public AjaxResult build(){

            return new AjaxResult(this);

        }

    }

    public Boolean getSuccess() {
        return success;
    }

    public String getMessage() {
        return message;
    }

    public Object getData() {
        return data;
    }
}
